using System.Collections.Generic;
using UnityEngine;

public class RaceCheckPoint : MonoBehaviour
{
	private List<RaceCheckpointPlayer> _checkpointPassTime = new List<RaceCheckpointPlayer>();

	public List<RaceCheckpointPlayer> CheckpointPassTime
	{
		get
		{
			return _checkpointPassTime;
		}
	}

	public void AddTimeForPlayer(PlayerBehavior player, float time)
	{
		RaceCheckpointPlayer raceCheckpointPlayer = _checkpointPassTime.Find((RaceCheckpointPlayer x) => x.name == player.photonView.owner.GetValueByKey(PlayerPropsKeys.nickname, string.Empty));
		int num = -1;
		num = ((raceCheckpointPlayer != null) ? (raceCheckpointPlayer.circleIndex + 1) : 0);
		_checkpointPassTime.Add(new RaceCheckpointPlayer(player.photonView.owner.GetValueByKey(PlayerPropsKeys.nickname, string.Empty), time, player.isMine, num));
	}

	private void OnTriggerEnter(Collider other)
	{
		CarBehavior componentInParent = other.GetComponentInParent<CarBehavior>();
		if (componentInParent != null && componentInParent == PrivateCarManager.instance.currentCar)
		{
			RaceController.instance.CheckPointPassed(this);
		}
	}
}
